﻿using FlowSequencer.Core.FlowElements;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FlowSequencer.Core.Tests
{
    class LineGenerator
    {
        public static Line GetLine(int numOfFlows, int sumCycles)
        {
            if (numOfFlows > sumCycles) return null;
            sumCycles -= numOfFlows;

            var line = new Line();
            for (int i = 0; i < numOfFlows; i++)
            {
                line.Tasks.Add(new Task() { Name = i.ToString() });
            }
            while (sumCycles != 0)
            {
                var rnd = new Random().Next(numOfFlows);
                line.Tasks[rnd].Cycles++;
                
                sumCycles--;
               
            }
            return line;
        }
    }
}
